﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserFrm.aspx.cs" Inherits="WebApp.UserFrm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>用户信息</title>
    <link rel="stylesheet" type="text/css" href="css/newStyle.css" />
    <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.3.2/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.3.2/themes/icon.css" />

    <script type="text/javascript" src="js/common.js"></script>

    <script type="text/javascript" src="js/jquery-easyui-1.3.2/jquery-1.8.0.min.js"></script>

    <script type="text/javascript" src="js/jquery-easyui-1.3.2/jquery.easyui.min.js"></script>

    <script type="text/javascript">
        //页面加载
        $(document).ready(function() {
            initData();
            initGrid();
        });

        $(window).resize(function() {
            $('#tb').datagrid('resize');
        });

        function doSearch(data) {
            //$('#tb').datagrid('reload', params);
            if (data) {
                if (data.rows.length > 0) {
                    var qCode = $('#qCode').val();
                    var qUserName = $('#qUserName').val();
                    if (data.rows.code.indexOf(qCode) | data.userName.indexOf(qUserName))
                        return data;
                    else
                        return null;
                }
            }
        }

        //加载表格datagrid
        function initGrid() {
            //加载数据
            $('#tb').datagrid({
                toolbar: '#searchBar',
                width: 'auto',
                //fit:true,
                //fitColumns: true,
                height: '500',
                striped: true,
                singleSelect: true,
                url: 'JSONHandler.ashx?DataType=User',
                //queryParams: params,
                loadMsg: '数据加载中请稍后……',
                pagination: true,
                rownumbers: true,
                columns: [[
        { field: 'id', title: 'id', align: 'center', hidden: true },
        { field: 'code', title: '用户帐号', align: 'center' },
        { field: 'userName', title: '用户名称', align: 'center' },
        { field: 'role', title: '用户角色', align: 'center' },
        { field: 'sex', title: '性别', align: 'center' },
        { field: 'post', title: '职务', align: 'center' },
        { field: 'tel', title: '联系电话', align: 'center' },
        { field: 'leader', title: '上级主管', align: 'center' }
    ]], onDblClickRow: function(rowIndex, rowData) {
        editFee();
    }, loadFilter: doSearch
            });

        }

        function initData() {

            
        }

        function resetAll() {
            $('#fm').form('clear');
        }

        function editFee() {
            var row = $('#tb').datagrid('getSelected');
            if (row) {
                var orderId = row.OrderId;
                var feeId = row.Id;
                var feeType = row.FeeType;
                if (feeId)
                    openWin('EditFeeFrm.aspx?FeeType=' + feeType + '&OrderId=' + orderId + '&FeeId=' + feeId, "编辑费用", 600, 400);
            }
        }

        function openWin(url, title, width, height) {
            $('#winFrame').prop('src', url);
            $('#winFrame').prop('style').height = height + 'px';
            $('#winFrame').prop('style').width = width + 'px';
            $('#win').window({
                title: title,
                width: width + 'px',
                height: height + 'px',
                modal: true
            });
        }      
    </script>

</head>
<body style="padding: 5px">
    <form id="form1" runat="server">
    </form>
    <form id="fm">
    <div id="searchBar" style="padding: 5px; height: auto">
        <span>帐号：</span><input type="text" style="width: 100px" id="qCode">
        <span>名称：</span><input type="text" style="width: 100px" id="qUserName">
        <a href="#" class="easyui-linkbutton" iconcls="icon-search" plain="true" onclick="doSearch();">
            搜索</a> <a href="#" class="easyui-linkbutton" iconcls="icon-undo" plain="true" onclick="resetAll();">
                重置</a> <a href="#" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="addUser();">
                    新增</a> <a href="#" class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="deleteUser();">
                        删除</a>
    </div>
    <table id="tb">
    </table>
    <div id="win">
        <iframe id="winFrame" src="" style="width: 0px; height: 0px" frameborder="0" scrolling="no">
        </iframe>
    </div>
    </form>
</body>
</html>
